package com.xiaobao.controller;

import com.xiaobao.pojo.Major;
import com.xiaobao.pojo.Result;
import com.xiaobao.service.MajorService;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

//专业控制器
@RestController
public class MajorController {
    private final MajorService majorService;

    public MajorController(MajorService majorService) {
        this.majorService = majorService;
    }

    //获取所有专业
    @GetMapping("/getAllMajors")
    public Result<Major[]> getAllMajor() {
        return new Result<>(HttpStatus.OK, majorService.getAllMajor(), "查询成功");
    }
}
